const mongoose = require("mongoose");

const schema = new mongoose.Schema({
  account: { type: String },
  type: {
    type: String,
    default: "2", // 用户类型，1为普通用户，2为超级管理员
  },
  file: {
    type: String,
    default: "https://zhengwei66.cn/uploads/1b732c3cf1896ba706491e3570b3abcd",
  },
  password: {
    type: String,
    select: false,
    set(val) {
      return require("bcrypt").hashSync(val, 10);
    },
  },
  power: {
    type: String,
    default: 1, // 权限字段，1为正常，2为禁用
  },
});

module.exports = mongoose.model("AdminUser", schema);
